//
//  FullBrevityTest.cpp
//  GRE
//
//  Created by Kutlak Roman on 23/11/2011.
//  Copyright (c) 2011 University of Aberdeen. All rights reserved.
//

#include <iostream>
using namespace std;

#include "gtest/gtest.h"

#include "FullBrevity.h"
using namespace kutlak::roman::gre;

TEST(FullBrevity, Constructor)
{
    FullBrevity fb;
}

TEST(FullBrevity, AltConstructor)
{
    FullBrevity fb
    (pKnowledgeBase
     (new KnowledgeBase("/Users/roman/Projects/NLP/GRE/resources/example.nt")));
    
}

TEST(FullBrevity, MRE)
{
    Ontology::SetDefault
    (pOntology
     (new Ontology("/Users/roman/Projects/NLP/GRE/resources/ontology.nt")));

    FullBrevity fb
    (pKnowledgeBase
     (new KnowledgeBase("/Users/roman/Projects/NLP/GRE/resources/example.nt")));

    RefExp re = fb.MakeReferringExpression("a");
    RefExp expected;
    expected.Add(Property("determiner", "definite"));
    expected.Add(Property("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "funnyDesk"));
    EXPECT_EQ(expected, re);
    expected.Clear();
    
    re = fb.MakeReferringExpression("e");
    expected.Add(Property("determiner", "indefinite"));
    expected.Add(Property("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "chair"));
    expected.Add(Property("contains", "metal"));
    expected.Add(Property("origin", "Italy"));
    expected.Add(Property("colour", "dark"));
    EXPECT_EQ(expected, re);
    expected.Clear();
    
    re = fb.MakeReferringExpression("d");
    expected.Add(Property("determiner", "definite"));
    expected.Add(Property("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "chair"));
    expected.Add(Property("contains", "cotton"));
    EXPECT_EQ(expected, re);
}

TEST(FullBrevity, MRE2)
{
    Ontology::SetDefault
    (pOntology
     (new Ontology("/Users/roman/Projects/NLP/GRE/resources/ontology.nt")));
    
    FullBrevity fb
    (pKnowledgeBase
     (new KnowledgeBase("/Users/roman/Projects/NLP/GRE/resources/AlgTest.nt")));
    
    RefExp re;
    RefExp expected;
    
    re = fb.MakeReferringExpression("e01");
    expected.Add(Property("determiner", "definite"));
    expected.Add(Property("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "http://www.w3.org/2002/07/owl#Thing"));
    expected.Add(Property("size", "large"));
    expected.Add(Property("shape", "round"));
    EXPECT_EQ(expected, re);
    expected.Clear();
    
    re = fb.MakeReferringExpression("e02");
    expected.Add(Property("determiner", "definite"));
    expected.Add(Property("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "http://www.w3.org/2002/07/owl#Thing"));
    expected.Add(Property("shape", "square"));
    expected.Add(Property("colour", "green"));
    EXPECT_EQ(expected, re);
    expected.Clear();
    
    re = fb.MakeReferringExpression("e03");
    expected.Add(Property("determiner", "indefinite"));
    expected.Add(Property("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "http://www.w3.org/2002/07/owl#Thing"));
    expected.Add(Property("shape", "round"));
    expected.Add(Property("colour", "green"));
    expected.Add(Property("size", "small"));
    EXPECT_EQ(expected, re);
    expected.Clear();
    
    re = fb.MakeReferringExpression("e04");
    expected.Add(Property("determiner", "indefinite"));
    expected.Add(Property("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "http://www.w3.org/2002/07/owl#Thing"));
    expected.Add(Property("shape", "round"));
    expected.Add(Property("colour", "green"));
    expected.Add(Property("size", "small"));
    EXPECT_EQ(expected, re);
    
}
